package com.zztpc.ljl.myapplication;

import android.graphics.Color;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;


import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        LineChart lineChart=findViewById(R.id.line_Chart);
        //List<Entity> list = new ArrayList<>();
        ArrayList<Entry> list1=new ArrayList<>();
        list1.add(new Entry(1,3));
        list1.add(new Entry(2,8));
        list1.add(new Entry(3,6));
        list1.add(new Entry(4,4));
        list1.add(new Entry(5,3));
        ArrayList<Entry> list2=new ArrayList<>();
        list2.add(new Entry(2,6));
        list2.add(new Entry(4,5));
        list2.add(new Entry(7,2));
        list2.add(new Entry(8,6));
        list2.add(new Entry(3,6));
        LineDataSet lineDataSet=new LineDataSet(list1,null);
        lineDataSet.setColor(Color.BLACK);
        LineDataSet lineDataSet1=new LineDataSet(list2,null);
        lineDataSet1.setColor(Color.RED);
        ArrayList<ILineDataSet> list_linData=new ArrayList<>();
        list_linData.add(lineDataSet);
        list_linData.add(lineDataSet1);
        LineData lineData=new LineData(list_linData);

        lineChart.setData(lineData);
        XAxis xAxis=lineChart.getXAxis();
       // LineData lineData=new LineData(lineDataSet);
       //LineData lineData1=new LineData(lineDataSet1);
       // ArrayList<LineData> set=new ArrayList<>();
       // set.add(lineData);
       // set.add(lineData1);

       // lineChart.setData(lineData1);


        //xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
    }
}
